home *** CD-ROM | disk | FTP | other *** search
/ Armageddon - Interactive Preview / Interactive Preview: Armageddon.iso / pc / control.dxr / Scripts & Behaviors_16_Slider Controller.ls < prev    next >
Encoding:
Text File  |  1998-05-19  |  1.3 KB  |  51 lines

  1. global gSoundLevel
  2.  
  3. on mouseWithin me
  4.   cursor(260)
  5. end
  6.  
  7. on mouseLeave me
  8.   cursor(0)
  9. end
  10.  
  11. on mouseDown me
  12.   cursor(290)
  13.   set topH to 535
  14.   set topV to 360
  15.   set bottomH to 549
  16.   set bottomV to 445
  17.   set startV to the mouseV
  18.   set thisWidth to the width of sprite the currentSpriteNum / 2
  19.   repeat while the mouseDown
  20.     if startV > the mouseV then
  21.       set newV to the mouseV
  22.       if newV < topV then
  23.         set newV to topV
  24.       end if
  25.       set y1 to float(bottomV - newV) / float(bottomV - topV)
  26.       set y2 to topH - integer(float(bottomH - topH) * y1)
  27.       set the locV of sprite the currentSpriteNum to newV
  28.       set the locH of sprite the currentSpriteNum to y2 + thisWidth
  29.       set gSoundLevel to integer(y1 * 255)
  30.       set the volume of sprite 24 to gSoundLevel
  31.     end if
  32.     if startV < the mouseV then
  33.       set newV to the mouseV
  34.       if newV > bottomV then
  35.         set newV to bottomV
  36.       end if
  37.       set y1 to float(bottomV - newV) / float(bottomV - topV)
  38.       set y2 to topH - integer(float(bottomH - topH) * y1)
  39.       set the locV of sprite the currentSpriteNum to newV
  40.       set the locH of sprite the currentSpriteNum to y2 + thisWidth
  41.       set gSoundLevel to integer(y1 * 255)
  42.       set the volume of sprite 24 to gSoundLevel
  43.     end if
  44.     updateStage()
  45.   end repeat
  46. end
  47.  
  48. on mouseUp me
  49.   cursor(260)
  50. end
  51.